home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / bro / TwistLaser.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  2.4 KB  |  95 lines

  1. class classes.bro.TwistLaser
  2. {
  3.    var x;
  4.    var y;
  5.    var id;
  6.    var dir;
  7.    var pos;
  8.    var clip;
  9.    var axis;
  10.    var w;
  11.    var h;
  12.    var xwcI;
  13.    var ywcI;
  14.    var exploX;
  15.    var exploY;
  16.    var xMov = 0;
  17.    var yMov = 0;
  18.    var power = 4;
  19.    var xwc = 0;
  20.    var ywc = 0;
  21.    function TwistLaser(px, py, pDir, pPos, pid)
  22.    {
  23.       this.x = px;
  24.       this.y = py;
  25.       this.id = pid;
  26.       this.dir = pDir;
  27.       this.pos = pPos;
  28.       _root.d = _root.d + 1;
  29.       this.clip = _root.attachMovie("twistLaser","twistLaser" + this.id + "Clip",_root.d);
  30.       this.clip._x = this.x;
  31.       this.clip._y = this.y;
  32.       this.clip.id = this.id;
  33.       if(this.dir == "U")
  34.       {
  35.          this.axis = "y";
  36.          this.yMov = -22;
  37.          this.xMov = 0;
  38.          this.y += 22;
  39.       }
  40.       else if(this.dir == "D")
  41.       {
  42.          this.axis = "y";
  43.          this.yMov = 22;
  44.          this.xMov = 0;
  45.          this.y -= 22;
  46.       }
  47.       else if(this.dir == "R")
  48.       {
  49.          this.axis = "x";
  50.          this.yMov = 0;
  51.          this.xMov = 22;
  52.          this.x -= 22;
  53.       }
  54.       else
  55.       {
  56.          this.axis = "x";
  57.          this.yMov = 0;
  58.          this.xMov = -22;
  59.          this.x += 22;
  60.       }
  61.       this.clip.gotoAndStop(this.dir);
  62.       this.w = this.clip._width;
  63.       this.h = this.clip._height;
  64.       this.xwcI = !(this.dir == "L" || this.dir == "R") ? 0.5 : 0;
  65.       this.ywcI = !(this.dir == "L" || this.dir == "R") ? 0 : 0.5;
  66.       _root.stats.fired = _root.stats.fired + 1;
  67.    }
  68.    function hit()
  69.    {
  70.       _root.stats.hit = _root.stats.hit + 1;
  71.       _root.createGunExplo([this.exploX,this.exploY,_root.randRange2(50,80)]);
  72.       _root.removeBroShot("twistLaser" + this.id);
  73.    }
  74.    function main()
  75.    {
  76.       this[this.axis + "Mov"] *= 1.03;
  77.       if(this.x > 1075 || this.x < -75 || this.y > 675 || this.y < -75)
  78.       {
  79.          _root.removeBroShot("twistLaser" + this.id);
  80.       }
  81.       if(this.pos == "top")
  82.       {
  83.          this.x += this.xMov + 2.5 * Math.sin(this.xwc += this.xwcI);
  84.          this.y += this.yMov + 2.5 * Math.sin(this.ywc += this.ywcI);
  85.       }
  86.       else
  87.       {
  88.          this.x += this.xMov + -2.5 * Math.sin(this.xwc += this.xwcI);
  89.          this.y += this.yMov + -2.5 * Math.sin(this.ywc += this.ywcI);
  90.       }
  91.       this.clip._x = this.x;
  92.       this.clip._y = this.y;
  93.    }
  94. }
  95.